package zx.x.modules.app.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import zx.x.modules.app.entity.SysOrderTaskEntity;
import zx.x.modules.app.service.SysOrderTaskService;
import zx.x.common.utils.PageUtils;
import zx.x.common.utils.R;



/**
 * 订单取消定时任务表
 *
 * @author x
 * @email x
 * @date 2022-10-28 16:38:46
 */
@RestController
@RequestMapping("app/sysordertask")
public class SysOrderTaskController {
    @Autowired
    private SysOrderTaskService sysOrderTaskService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = sysOrderTaskService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("app:sysordertask:info")
    public R info(@PathVariable("id") Integer id){
		SysOrderTaskEntity sysOrderTask = sysOrderTaskService.getById(id);

        return R.ok().put("sysOrderTask", sysOrderTask);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("app:sysordertask:save")
    public R save(@RequestBody SysOrderTaskEntity sysOrderTask){
		sysOrderTaskService.save(sysOrderTask);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("app:sysordertask:update")
    public R update(@RequestBody SysOrderTaskEntity sysOrderTask){
		sysOrderTaskService.updateById(sysOrderTask);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("app:sysordertask:delete")
    public R delete(@RequestBody Integer[] ids){
		sysOrderTaskService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
